<script language="javascript">
$(function(){
	$('#mainform').validate({
		errorClass: "wrong",
		rules:{
			txtBuyNum:{maxValue: <smart> $p_storage-$p_sold_num </smart>},
			txtPayPrice:{minValue: <smart> $min_price </smart>}
		},
		messages:{
			txtBuyNum: {
				maxValue: "购买数量不能大于<smart> $p_storage-$p_sold_num </smart>件"
			},
			txtPayPrice: {
				minValue: "价格不能低于<smart> $min_price </smart>元"
			}
		}});
		$('table.bb tr td input').focus(function() { $(this).parent().next().find('label').addClass('label_focus') }).blur(function() { $(this).parent().next().find('label').removeClass('label_focus') });
})
</script>